/**
 * losenote.com Inc.
 * Copyright (c) 2013-2013 All Rights Reserved.
 */
package com.losenote.web.ct;

import com.losenote.service.req.AnswerReq;
import com.losenote.web.form.AnswerForm;

/**
 * 回答问题请求转换器
 * 
 * @author danjingyu
 * @version $Id: AnswerReqCt.java, v 0.1 2013-11-3 下午9:53:48 danjingyu Exp $
 */
public class AnswerReqCt {

    /**
     * 转换器
     * 
     * @param answerForm
     * @return
     */
    public static AnswerReq fromForm(AnswerForm answerForm) {
        AnswerReq req = new AnswerReq();
        for (int index = 0; index < answerForm.getQuestionId().length; index++) {
            req.getQuestionIds().add(answerForm.getQuestionId()[index]);
            req.getAnswers().add(answerForm.getAnswer()[index]);
        }
        return req;
    }

}
